Skip to main content
This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal

Notes/Domino 6 and 7 Forum

Notes/Domino 6 and 7 Forum


  

PreviousPrevious NextNext

RE: Java agent ans WAS5
~Dana Prejipyvergon 26.Nov.03 12:19 PM a Web browser
Domino Designer 6.0.2 CF2 All Platforms


Sriram, I don't know where you get your information from (how Threads are used in agents), but this solved my problem.

I've been trying to connect to a JBoss 2.4.8 server's JMS and using the ThreadGroup technique I finally got it working. I don't know if this is what you meant, but here's how I did it, for anyone interested:

First off, I am running on a domino 6 client for development. I added a lot of JBoss jar files to the Lotus\Notes6\jvm\lib\ext directory. You need these avaiable.

import lotus.domino.*;

import java.util.Properties;

import javax.naming.Context;
import javax.naming.InitialContext;

import javax.jms.Message;
import javax.jms.Queue;
import javax.jms.QueueConnection;
import javax.jms.QueueConnectionFactory;
import javax.jms.QueueSender;
import javax.jms.QueueSession;

public class JavaAgent extends AgentBase {

private class ThreadContents implements Runnable {
public void run() {
try {
String providerUrl = "xxx.xxx.xxx.xxx:1099"; // JBoss server ip address and port
String contextFactory = "org.jnp.interfaces.NamingContextFactory";
String urlPkgPrefixes = "org.jboss.naming";
String queueName = "queue/testQueue";

Properties properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY, contextFactory);
properties.put(Context.PROVIDER_URL, providerUrl);
properties.put(Context.URL_PKG_PREFIXES, urlPkgPrefixes);

InitialContext context = new InitialContext(properties);

System.out.println("lookup session");

QueueConnectionFactory factory = (QueueConnectionFactory) context.lookup("QueueConnectionFactory");
QueueConnection connection = factory.createQueueConnection();
QueueSession session = connection.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);

System.out.println("lookup queue");

Queue queue = (Queue) context.lookup(queueName);

System.out.println("sending message");

QueueSender sender = session.createSender(queue);
Message message = session.createTextMessage("this is the message from the domino agent");
sender.send(message);

sender.close();
connection.close();
context.close();

System.out.println("thread done");
}
catch(Exception e) {
e.printStackTrace();
}
}
}

public void NotesMain() {
try {
Session notessession = getSession();
AgentContext agentContext = notessession.getAgentContext();

ThreadGroup group = new ThreadGroup("externalgroup");

Thread t = new Thread(group, new ThreadContents());
t.start();
t.join();

if (group != null && !group.isDestroyed()) {
System.out.println("destroying thread group");
group.destroy();
}

System.out.println("agent done");
} catch(Exception e) {
e.printStackTrace();
}
}
}




Java agent ans WAS5 (~Gus Minjumiman... 22.Oct.03)
. . RE: Java agent ans WAS5 eom> (~Bella Asaresab... 22.Oct.03)
. . RE: Java agent ans WAS5 (~Sean Rehipiter... 27.Oct.03)
. . . . RE: Java agent ans WAS5 (~Bella Asaresab... 27.Oct.03)
. . . . . . RE: Java agent ans WAS5 (~Dana Prejipyve... 26.Nov.03)
. . . . . . RE: Java agent ans WAS5 (~Sean Rehipiter... 28.Oct.03)


Document Options






  Document options
Print this pagePrint this page

Search this forum

Forum views and search


  Forum views and search
Date (threaded)
Date (flat)
With excerpt
Category
Platform
Release
Advanced search

Member Tools


RSS Feeds

 RSS feedsRSS
All forum posts RSS
All main topics RSS